Skip to content

Rework and enable Wasm.Build.Tests.Blazor.AssetCachingTests#123388

Merged
oroztocil merged 7 commits intomainfrom
oroztocil/asset-caching-test-fix
Jan 21, 2026
Merged

Rework and enable Wasm.Build.Tests.Blazor.AssetCachingTests#123388
oroztocil merged 7 commits intomainfrom
oroztocil/asset-caching-test-fix

Conversation

@oroztocil
Copy link
Member

@oroztocil oroztocil commented Jan 20, 2026

AssetCachingTests check that only the expected requests for Wasm assets are actually sent by the client to the server, based on whether asset fingerprinting is enabled or not. Fingerprinted assets should be always retrieved from the browser cache after the initial load.

Previously, the test relied on reading server logs from the stdout of the test server application. This was likely the cause of the test's flakiness.

The PR replaces the mechanism with an API endpoint exposed by the the server that is used by the test code to retrieve the captured request logs. The test is re-enabled and added to BuildWasmAppsJobsList.txt.

@oroztocil oroztocil requested a review from maraf as a code owner January 20, 2026 17:18
Copilot AI review requested due to automatic review settings January 20, 2026 17:18
@oroztocil oroztocil requested a review from ilonatommy as a code owner January 20, 2026 17:18
@oroztocil oroztocil removed the request for review from maraf January 20, 2026 17:19
@oroztocil oroztocil requested a review from maraf January 20, 2026 17:19
@oroztocil oroztocil added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Jan 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Wasm.Build.Tests.Blazor.AssetCachingTests to improve test reliability by replacing stdout-based log parsing with an HTTP API endpoint. The test server now exposes /request-logs endpoints to retrieve and clear captured request logs, eliminating the previous source of flakiness.

Changes:

  • Added request logging middleware and API endpoints to the BlazorWebWasm test server
  • Created a client library (BlazorWebWasmLogClient) to interact with the logging API from tests
  • Updated the test to use the new API-based approach instead of parsing server stdout
  • Updated target framework from net10.0 to net11.0 in test assets
  • Optimized Counter.razor to log only on first render
  • Re-enabled the test by removing the ActiveIssue attribute and adding it back to BuildWasmAppsJobsList.txt

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
BlazorWebWasm/Program.cs Added middleware to capture HTTP request logs and API endpoints to retrieve/clear logs
BlazorWebWasmRequestLog.cs (testasset) New record type for capturing request details in the test server
BlazorWebWasm.csproj Updated target framework from net10.0 to net11.0
BlazorWebWasm.Client.csproj Updated target framework from net10.0 to net11.0
Counter.razor Modified to log only on first render to reduce noise
ServerRequestLog.cs New record type (appears unused)
BlazorWebWasmRequestLog.cs (test) New record type matching the testasset structure for deserialization
BlazorWebWasmLogClient.cs New HTTP client for interacting with the test server's logging API
AssetCachingTests.cs Refactored to use the new API-based logging approach, removed ActiveIssue attribute
BuildWasmAppsJobsList.txt Re-enabled AssetCachingTests in the test job list

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Jan 20, 2026

@oroztocil I've opened a new pull request, #123390, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Jan 20, 2026

@oroztocil I've opened a new pull request, #123392, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Jan 20, 2026

@oroztocil I've opened a new pull request, #123393, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Member

@maraf maraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍

@maraf maraf added test-enhancement Improvements of test source code area-Infrastructure-mono labels Jan 21, 2026
@maraf maraf added this to the 11.0.0 milestone Jan 21, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@javiercn javiercn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@oroztocil
Copy link
Member Author

@copilot Implement changes proposed by @javiercn in comments

Copy link
Contributor

Copilot AI commented Jan 21, 2026

@oroztocil I've opened a new pull request, #123430, to work on those changes. Once the pull request is ready, I'll request review from you.

@oroztocil oroztocil enabled auto-merge (squash) January 21, 2026 13:54
@oroztocil oroztocil merged commit ebae784 into main Jan 21, 2026
27 checks passed
@jkotas jkotas deleted the oroztocil/asset-caching-test-fix branch January 24, 2026 03:44
@oroztocil
Copy link
Member Author

/backport to release/10.0

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

Started backporting to release/10.0 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-Infrastructure-mono os-browser Browser variant of arch-wasm test-enhancement Improvements of test source code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants